Universal Plug and Play

Universal Plug and Play (UPnP) is a system that allows devices to be remotely controlled across a network.

DarkNet does not currently support Universal Plug and Play in its entirety; it only has support for NAT traversal. Using UPnP NAT traversal you can programmatically setup port forwarding entries for your router.

UPnP is fairly unreliable and is prone to failure. This is not due to any fault in DarkNet, but due to the nature of UPnP. UPnP can fail for one of the following reasons:

  1. UPnP is disabled on the computer (XP has it disabled by default)
  2. UPnP is disabled on the router (most have it enabled by default)
  3. UPnP is having a bad day, and decided to give up (yes, it can fail for no apparent reason). Try restarting your computer and/or router in this case.

UPnP NAT errors can also occur in the following situations. The extent to which you experience such NAT errors depends on the router; some routers will let errors fail silently whilst others will complain at every stage possible:

  1. Our ‘view’ differs from that of the router. E.g. another application may delete a port map, we may then try to edit this port map which would cause an error. Regular use of mnUpdateNAT can help to prevent such problems.
  2. The router does not like an instruction. E.g. mnAddPortMap with a local IP that is invalid.

It is recommended that you disable error message boxes (mnToggleErrorMode) and check for errors silently using one of the other error modes. When an error occurs you can assume one of the above is the cause and abort attempts to use UPnP. You can then provide an alternative to UPnP such as instructing the user to manually setup port forwarding or NAT punch-through.

UPnP commands involve communication with the router which often takes several seconds to complete; for this reason most UPnP commands can be used in a non blocking (a synchronous) way so that other operations can be performed whilst the UPnP action completes. When using a command a synchronously mnPollUPNP should be used to determine when the action has completed.

1: mnAddPortMap
2: mnDeletePortMapA
3: mnDeletePortMapB
4: mnDisablePortMap
5: mnEnablePortMap
6: mnFindPortMap
7: mnFinishNAT
8: mnFinishUPNP
9: mnGetPortDescription
10: mnGetPortMapAmount
11: mnGetPortMapEnabled
12: mnGetPortMapExternalIP
13: mnGetPortMapExternalPort
14: mnGetPortMapInternalIP
15: mnGetPortMapInternalPort
16: mnGetPortMapProtocol
17: mnPollUPNP
18: mnPortMapExist
19: mnSetPortMapDescription
20: mnSetPortMapInternalIP
21: mnSetPortMapInternalPort
22: mnStartNAT
23: mnStartUPNP
24: mnUpdateNAT



This page is in the following sections:
(0) DarkNet Help